package com.youlai.boot.form.model.form;

import java.io.Serial;
import java.io.Serializable;

import com.youlai.boot.form.validator.ValidJson;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import jakarta.validation.constraints.*;

/**
 * 动态单定义表单对象
 *
 * @author rabit
 * @since 2025-10-27 16:47
 */
@Getter
@Setter
@Schema(description = "动态单定义表单对象")
public class FormDefinitionForm implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "表单ID（修改必传）")
    private Long id;

    @Schema(description = "表单编码")
    @NotBlank(message = "表单编码不能为空")
    @Size(max=100, message="表单编码长度不能超过100个字符")
    private String formCode;

    @Schema(description = "表单名称")
    @NotBlank(message = "表单名称不能为空")
    @Size(max=200, message="表单名称长度不能超过200个字符")
    private String formName;

    @Schema(description = "表单类型：custom(普通)/workflow(工作流)/survey(问卷)")
    @Size(max=50, message="表单类型：custom(普通)/workflow(工作流)/survey(问卷)")
    private String formType;

    @Schema(description = "表单结构JSON，描述字段组件结构")
    @NotBlank(message = "表单结构JSON，描述字段组件结构不能为空")
    @ValidJson(message = "表单结构必须是有效的JSON格式")
    private String formSchema;

    @Schema(description = "描述信息")
    @Size(max=255, message="描述信息长度不能超过255个字符")
    private String description;

    @Schema(description = "状态：0启用(默认) 1停用")
    private Integer status;

    @Schema(description = "排序字段")
    private Integer sort;

}
